import localforage from "localforage";

/**
 * 保存搜索的表单
 * @param {*} form
 */
export async function setSearchForm(form) {
  await localforage.setItem("search-form", form);
}

/**
 * 获取搜索的表单
 */
export async function getSearchForm() {
  let res = await localforage.getItem("search-form");
  return res;
}

/**
 * 移除搜索的表单
 */
export async function removeSearchForm() {
  await localforage.removeItem("search-form");
}


/**
 * 保存searchData
 * @param {*} searchData
 */
export async function setSearchDataCache(searchData) {
  await localforage.setItem("search-data", searchData);
}

/**
 * 获取搜索的表单
 */
export async function getSearchDataCache() {
  let res = await localforage.getItem("search-data");
  return res;
}

/**
 * 移除搜索的表单
 */
export async function removeSearchDataCache() {
  await localforage.removeItem("search-data");
}

